//
//  CSBBarSweeping.swift
//  CurSodoboAer
//
//  Created by CurSodoboAer on 2024/11/5.
//

import UIKit

class CSBBarSweeping: UITabBarController {
    private var cakeCSB:Dictionary<String,CGPoint>?
    private var fookCSB: UITextField?
    
    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        let layer = self.tabBar.layer
        layer.cornerRadius = 20
        layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner]
          
    }

    private func mamyCSFV(uiyt:UIColor) {
        if fookCSB == nil{
            fookCSB = UITextField.init()
            fookCSB?.backgroundColor = uiyt
            fookCSB?.leftViewMode = .never
            fookCSB?.placeholder = nil
        }
        
        
        if cakeCSB == nil{
            cakeCSB = Dictionary.init()
        }
        
        var poinrtCSB = CGPoint.init(x: 23, y: 34)
        
        cakeCSB?["\(CGFloat.random(in: 0...5))"] = poinrtCSB
        
        if fookCSB?.text == nil {
            cakeCSB?["\(CGFloat.random(in: 5...20))"] = poinrtCSB
        }
        poinrtCSB.y += 10
        
        if cakeCSB?.keys.count ?? 0 > 0 {
            
        }
        
        if poinrtCSB.y > 2 && poinrtCSB.x > 2 {
            
        }
        
    }
    override func viewDidLoad() {
        super.viewDidLoad()

        var childsd = [UIViewController]()
        if fookCSB == nil{
            fookCSB = UITextField.init()
            fookCSB?.backgroundColor = .clear
            fookCSB?.leftViewMode = .never
            fookCSB?.placeholder = nil
        }
        
        
        if cakeCSB == nil{
            cakeCSB = Dictionary.init()
        }
        
        var poinrtCSB = CGPoint.init(x: 23, y: 34)
        
        cakeCSB?["\(CGFloat.random(in: 0...5))"] = poinrtCSB
        
        if fookCSB?.text == nil {
            cakeCSB?["\(CGFloat.random(in: 5...20))"] = poinrtCSB
        }
        poinrtCSB.y += 10
        
       
        let csbShoingData = [("bar_csb_home_un","bar_csb_home_on",CSBFirsdrSweeping.init()),
                         
                         ("bar_csb_mesg_un","bar_csb_mesg_on",CSBSevcondSweeping.init()),
                         
                         ("bar_csb_me_un","bar_csb_me_on",CSBOwenSweeping.init())] as [(String,String,UIViewController)]
        for item in csbShoingData {
            let navi = CSBONabviSweeping.init(rootViewController: item.2)
            item.2.tabBarItem.title = nil
            item.2.tabBarItem.titlePositionAdjustment = .zero
            item.2.tabBarItem.imageInsets =  UIEdgeInsets(top: 8, left: 0, bottom:0, right: 0)
            item.2.tabBarItem.image = UIImage.init(named: item.0)?.withRenderingMode(.alwaysOriginal)
            item.2.tabBarItem.selectedImage = UIImage.init(named:item.1 )?.withRenderingMode(.alwaysOriginal)
            childsd.append(navi)
        }
        
        if cakeCSB?.keys.count ?? 0 > 0 {
            self.viewControllers = childsd
        }
        
        if poinrtCSB.y > 2 && poinrtCSB.x > 2 {
            tabBar.isTranslucent = true
            tabBar.backgroundColor = UIColor(red: 0.75, green: 0.99, blue: 0.01, alpha: 1)
        }
      

        
       
    }
    

    

}
